/**
 * 
 */
package org.cuatrovientos.page28exercise6;
import java.util.Scanner;

/**
 * Simple class to get the IMC.
 * @author Axel Brinck
 */
public class Page28Exercise6 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		//We use this to prepare the user input
		Scanner reader = new Scanner(System.in);
		
		//Variable declaration
		String input = "";
		float weight = 0f;
		float height = 0f;
		float imc = 0f;
		
		//Get weight from user input and bind it to its proper variable.
		System.out.println("IMC Indicator.");
		System.out.print("Introduce your weight: ");
		input = reader.nextLine();
		weight = Float.parseFloat(input);
		
		//Get height from user input and bind it to its proper variable.
		System.out.print("Introduce your height: ");
		input = reader.nextLine();
		height = Float.parseFloat(input);
		
		//To terminate the user input
		reader.close();
		
		//Store the IMC
		imc = (float) (weight / Math.pow(height, 2)) * 10000;
		
		//Output respective message based on the IMC.
		System.out.println("IMC: " + imc);
		if (imc < 16) 					{System.out.println("You need to eat more.");}
		if ((imc >= 16) && (imc < 25))	{System.out.println("You're OK.");}
		if ((imc >= 25) && (imc < 30))	{System.out.println("You need a healthier life.");}
		if (imc >= 30) 					{System.out.println("Go to the hospital.");}
		
	}
	
}
